//
//  RecommendViewController.m
//  hai游～
//
//  Created by dllo on 15/5/26.
//  Copyright (c) 2015年 jakf_17. All rights reserved.
//

#import "RecommendViewController.h"

@interface RecommendViewController ()<UIWebViewDelegate>

@end

@implementation RecommendViewController

- (void)dealloc
{
    [self.url release];
    [super dealloc];
}
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self createWebView];
    [self createActivityIndicatorView];
}

- (void)createWebView
{
    UIWebView *web = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    web.scalesPageToFit = YES;
    web.delegate = self;
    NSURL *url = [NSURL URLWithString:self.url];
    NSURLRequest *req = [NSURLRequest requestWithURL:url];
    [self.view addSubview:web];
    [web loadRequest:req];
    [web release];
}
- (void)createActivityIndicatorView
{
    self.actIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 32.0f, 32.0f)];
    [self.actIndicator setCenter:self.view.center];
    [self.actIndicator setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleGray];
    [self.view addSubview:self.actIndicator];
    [self.actIndicator release];
}
- (void)webViewDidStartLoad:(UIWebView *)webView
{
    [self.actIndicator startAnimating];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [self.actIndicator stopAnimating];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
